package com.wzl.plugins.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Component;

@Component
@Data
@RefreshScope
public class NacosConfig {

    @Autowired
    private ConfigurableApplicationContext configurableApplicationContext;

    public String serverName;

    public String getServerName() {
        return serverName = configurableApplicationContext.getEnvironment()
                .getProperty(NacosConstants.serverName);
    }

    public String dataSourceName;

    public String getDataSourceName() {
        return dataSourceName = configurableApplicationContext.getEnvironment()
                .getProperty(NacosConstants.dataSourceName);
    }

    public String message;

    public String getMessage() {
        return message = configurableApplicationContext.getEnvironment()
                .getProperty(NacosConstants.message);
    }

}
